import { ApiCollectionItem, SchemaCollectionDetail } from '../types';

let rootItems: ApiCollectionItem[] = [];
let schemaCollection: SchemaCollectionDetail[] = [];

const codeMap = new Map();
const apiMap = new Map();
const schemaMap = new Map();
const entityMap = new Map();

export function setRootAPI(value: ApiCollectionItem[]) {
  rootItems = value;
}

export function getRootAPI() {
  return rootItems;
}

export function setRootSchema(value: SchemaCollectionDetail[]) {
  schemaCollection = value;
}

export function getRootSchema() {
  return schemaCollection;
}

export function setApiMap(controller: string, api: string) {
  apiMap.set(controller, api);
}

export function getApiMap() {
  return apiMap;
}

export function setSchemaMap(controller: string, schema: string) {
  schemaMap.set(controller, schema);
}
export function getSchemaMapWithController(controller: string) {
  return schemaMap.get(controller);
}
export function getSchemaMap() {
  return schemaMap;
}

export function setEntityMap(name: string, properties: any) {
  apiMap.set(name, properties);
}

export function getEntityMap() {
  return apiMap;
}
